import config from "./config.js";

export default {
	getTokenAccess() {
		return uni.getStorageSync("tokenAccess");
	},
	setTokenAccess(tokenAccess) {
		uni.setStorageSync("tokenAccess", tokenAccess);
	},
	removeTokenAccess() {
		uni.removeStorageSync("tokenAccess")
	},
	getUser() {
		return uni.getStorageSync(config.env + "_user");
	},
	setUser(user) {
		uni.setStorageSync(config.env + "_user", user);
	},
	//同步设置缓存
	setCache(key, value) {
		if (!value) {
			return
		}
		uni.setStorageSync(key, JSON.stringify(value));
	},
	//同步获取缓存
	getCache(key) {
		return uni.getStorageSync(key);
	},
	//同步移除缓存
	removeCache(key) {
		uni.removeStorageSync(key);
	},

	//同步移除所有缓存
	removeCacheAll() {
		uni.clearStorageSync();
	}

}